import { createRouter, createWebHistory } from 'vue-router'
// 首页组件因为打开的时候就要展示
// 所以只有首页组件直接加载导入
// 其余组件懒加载形式
import SdyHome from '@/views/home/sdyHome.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: SdyHome,
      meta: { home: true }
    },
    {
      path: '/cate',
      name: 'cate',
      component: () => import('@/views/cate/sdyCate.vue'),
      meta: { more: true }
    },
    {
      path: '/cart',
      name: 'cart',
      component: () => import('@/views/cart/sdyCart.vue'),
      meta: { more: true }
    },
    {
      path: '/self',
      name: 'self',
      component: () => import('@/views/self/sdySelf.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/sdyLogin.vue'),
      meta: { footerHidden: true }
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('@/views/register/sdyRegister.vue'),
      meta: { footerHidden: true }
    },
    {
      path: '/search',
      name: 'search',
      component: () => import('@/views/search/sdySearch.vue'),
      meta: { search: true }
    },
    {
      path: '/list',
      name: 'list',
      component: () => import('@/views/list/sdyList.vue')
    },
    {
      path: '/detail',
      name: 'detail',
      component: () => import('@/views/detail/sdyDetail.vue')
    }
  ]
})

export default router
